<ul class="nav nav-tabs">
	<li><a href="javascript:;" ng-click="access_json('core/wxapp.list/list')">返回小程序列表</a></li>
</ul>
<div  ng-init="pagedata.get_url()">
	<div class="panel panel-default form-horizontal">
		<div class="panel-heading">授权二维码(温馨提示:目前一次只能处理一个请求，每次请求要一分钟左右！可能经常出现获取占线情况！)</div>
		<div class="panel-body">
			<div class="form-group text-center">
				<div class="col-sm-12">
					<div ng-show="!pagedata.item.ewm"><i class="fa fa-spinner today"></i></div>
					<div ng-show="!pagedata.item.ewm" style="padding:5px">正在获取二维码,请耐心等待,等待时间大约</div>
					<div ng-show="!pagedata.item.ewm" class="today" style="padding:5px" id="wait_ewm" ng-click="pagedata.get_url2()"></div>
					<div ng-show="pagedata.item.ewm" class="today" style="padding:5px">获取成功</div>
					<div style="margin-top:.5em;">
						<img ng-src="{{tomedia(pagedata.item.ewm) || '../core/resource/images/nopic.jpg'}}" class="img-responsive img-thumbnail" width="150" />
					</div>
					<div class="help-block" id="wait_sq">系统会将获取到的授权二维码显示在此处，显示后请在10秒内扫码授权</div>
					<div><button  class="btn btn-primary" ng-click="access_json('core/wxapp.up_list/')">查看上传结果</button></div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
window.scope.pagedata.get_url2=function(){
	var text=$('#wait_ewm').text();
	if(text=='点击重新获取'){
		window.scope.pagedata.get_url();
	}
}
window.scope.pagedata.get_url=function(){
	window.scope.count_down(15,'wait_ewm','秒','点击重新获取');
	window.scope.post({},'get_ewm','id='+window.scope.pagedata.id,function(res){
		//console.log(res);
		window.scope.pagedata.item=res;
		window.scope.pagedata.show_check=true;
		window.scope.$apply();
		window.scope.count_down(15,'wait_sq','秒后失效',function(){
			window.scope.pagedata.item.ewm={};
			window.scope.pagedata.show_check=false;
			$('#wait_sq').text('已失效！');
			$('#wait_ewm').text('点击重新获取！');
			window.scope.$apply();
		});
	});
}
</script>